/**
 * 环境api组合
 */
import { upgradeClientTip } from "./tip";

/** 退出小程序 */
export const exitMiniProgram = () => {
  if (uni.canIUse("exitMiniProgram") && uni.exitMiniProgram) {
    uni.exitMiniProgram({
      fail: () => {
        uni.showToast({
          title: "退出小程序失败",
          icon: "none",
        });
      },
    });
  } else {
    uni.navigateBack({
      delta: 1,
      fail: () => {
        upgradeClientTip("退出");
      },
    });
  }
};
